package com.winhxd.b2c.order.dao;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import com.winhxd.b2c.common.domain.order.condition.OrderAfterSaleCondition;
import com.winhxd.b2c.common.domain.order.condition.OrderBaseConditions;
import com.winhxd.b2c.common.domain.order.condition.OrderManagementListCondition;
import com.winhxd.b2c.common.domain.order.condition.OrderQueryCondition;
import com.winhxd.b2c.common.domain.order.condition.OrderSalesSummaryCondition;
import com.winhxd.b2c.common.domain.order.condition.OrderSummaryCondition;
import com.winhxd.b2c.common.domain.order.condition.OrderUserManagementQueryCondition;
import com.winhxd.b2c.common.domain.order.model.OrderInfo;
import com.winhxd.b2c.common.domain.order.vo.OrderInfoDetail4UserManagementVO;
import com.winhxd.b2c.common.domain.order.vo.OrderInfoVO;
import com.winhxd.b2c.common.domain.order.vo.OrderManagementListVO;
@Repository
public interface OrderInfoMapper {
    int deleteByPrimaryKey(Long id);

    int insert(OrderInfo record);

    int insertSelective(OrderInfo record);

    OrderInfo selectByOrderNo(@Param("orderNo") String orderNo);

    int updateByPrimaryKeySelective(OrderInfo record);

    int updateByOrderNo(OrderInfo record);

    int updateByPrimaryKey(OrderInfo record);

    /**
     * @author zhanghuan
     * @date  2018年10月26日 下午2:11:57
     * @Description 查询售后订单主表信息
     */
    OrderInfoVO selectOrderInfoByCondition(OrderAfterSaleCondition condition);

    /**
     * @Author lijianhua
     * @Description //今日销售额:本日截止当前时刻已支付且未确认退款的销售额
     * @Date 9:52 2019/1/9
     * @Param [condition]
     * @return java.math.BigDecimal
     **/
    BigDecimal selectSalesToday(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //今日新增订单:本日截止当前时刻已支付且未确认退款的销售额
     * @Date 9:53 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectOrderNumsToday(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //T待发货:显示当前订单状态处于“待发货”的订单数
     * @Date 9:53 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectOrderSendOutNum(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //售后中:显示当前进行中的售后单数量
     * @Date 9:53 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectOrderServiceNum(OrderSalesSummaryCondition condition);

    /**
     * @author shijinxing
     * @date  2019年1月9日10:01:35
     * @Description 后台管理-查询订单列表
     */
    List<OrderManagementListVO> selectOrderManagementList(OrderManagementListCondition condition);

    /**
     * 根据信息查询用户订单列表（带分页）
     * @param condition
     * @return
     */
    List<OrderInfoVO> selectOrderInfoListByCondition(OrderBaseConditions condition);

    /**
     * @Author lijianhua
     * @Description //用户待付款订单量
     * @Date 10:47 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectUnPayedNum(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //户待发货订单量
     * @Date 10:47 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectUnSendedNum(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //用户待收货订单量
     * @Date 10:47 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectUnReceiveNum(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //用户已收货数量
     * @Date 9:46 2019/1/17
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectReceivedNum(OrderSalesSummaryCondition condition);
    /**
     * @Author lijianhua
     * @Description //用户待售后订单量
     * @Date 10:48 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectUnServicedNum(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //用户待付款订单量
     * @Date 10:47 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectUnPayedNumAgentOne(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //户待发货订单量
     * @Date 10:47 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectUnSendedNumAgentOne(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //用户待收货订单量
     * @Date 10:47 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectUnReceiveNumAgentOne(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //一级经销商已收货
     * @Date 9:49 2019/1/17
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectReceivedNumAgentOne(OrderSalesSummaryCondition condition);
    /**
     * @Author lijianhua
     * @Description //用户待售后订单量
     * @Date 10:48 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectUnServicedNumAgentOne(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //用户待付款订单量
     * @Date 10:47 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectUnPayedNumAgentTwo(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //户待发货订单量
     * @Date 10:47 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectUnSendedNumAgentTwo(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //用户待收货订单量
     * @Date 10:47 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectUnReceiveNumAgentTwo(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //二级经销商已收货
     * @Date 9:50 2019/1/17
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectReceivedNumAgentTwo(OrderSalesSummaryCondition condition);
    /**
     * @Author lijianhua
     * @Description //用户待售后订单量
     * @Date 10:48 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectUnServicedNumAgentTwo(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //一级分销商新增订单
     * @Date 16:10 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectOrderNumsTodayAgentOne(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //一级分销商我的今日新增订单
     * @Date 16:11 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectOrderNumsTodayForMeAgentOne(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //一级分销商线下今日新增订单
     * @Date 16:11 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectOrderNumsTodayForReferralsAgentOne(OrderSalesSummaryCondition condition);

    /**
     * @Author lijianhua
     * @Description //二级分销商新增订单
     * @Date 16:10 2019/1/9
     * @Param [condition]
     * @return java.lang.Integer
     **/
    Integer selectOrderNumsTodayAgentTwo(OrderSalesSummaryCondition condition);

    /**
    * @author hjw
    * @date 2019/1/10 17:49
    * @param condition
    * @Description 查询订单所有信息
    * @return
    */
    List<OrderInfoVO> selectOrderAllInfo(OrderQueryCondition condition);
    

    List<OrderInfoVO> selectOrderAllInfoTest(OrderQueryCondition condition);

    /**
     * 
     * @author suhaochan
     * @date 2019年1月10日 下午2:11:38 
     * @Description 根据下单用户ID等条件查询会员订单列表
     * @param 
     * @return
     */
	List<OrderInfoDetail4UserManagementVO> selectMemberOrderInfoByParams(OrderUserManagementQueryCondition condition);
	
	/**
	 * 
	 * @author suhaochan
	 * @date 2019年1月10日 下午5:02:14 
	 * @Description 根据分销商用户ID等条件查询分销商会员订单列表
	 * @param 
	 * @return
	 */
	List<OrderInfoDetail4UserManagementVO> selectDistributorMemberOrder(OrderUserManagementQueryCondition condition);


	/**
	 * @Author lijianhua
	 * @Description //获取订单数量
	 * @Date 16:07 2019/1/12
	 * @Param [condition]
	 * @return java.lang.Integer
	 **/
    Integer selectOrderNum(OrderSummaryCondition condition);

    /**
     * @author zsg
     * 根据条件查询订单(带分页)
     * @param condition
     * @return
     */
    List<OrderInfoVO> selectOrderListByCondition(OrderQueryCondition condition);

    /**
     * 
     * @author suhaochan
     * @date 2019年1月19日 上午11:18:17 
     * @Description 根据下单人、订单状态获取订单数量
     * @param 
     * @return
     */
	Integer selectCountNumByCustomerIdAndStatus(Map<String, Object> params);

	/**
	 *
	 * @author suhaochan
	 * @date 2019年1月19日 上午11:29:45 
	 * @Description 根据下单人ID获取用户待售后订单数量
	 * @param 
	 * @return
	 */
	Integer selectUnServicedNumByCustomerId(OrderSalesSummaryCondition condition);


    int updateExtendStatusByOrderNo(OrderInfo orderInfo);
}